extends RefCounted
class_name BaseState

var state_machine:BaseStateMachine = null
var agent:Node:
	get:
		assert(state_machine and state_machine.agent,"状态机或代理不存在")
		return state_machine.agent

func _init(machine:BaseStateMachine):
	state_machine = machine

func enter(_msg:Dictionary = {}):
	pass

func exit():
	pass

func update(delta:float):
	pass

func transition_to(state_index:int,msg:Dictionary = {}):
	state_machine.current_state.exit()
	state_machine.current_state_index = state_index
	state_machine.current_state.enter(msg)
